<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>闭包中的事件监听</title>
</head>
<body>
    <button id="myButton">Click Me</button>
    <script>
        const obj = {
            message: 'fog',
            init: function() {
                const button = document.getElementById('myButton');
                const that = this;
                button.addEventListener('click',function() {
                    console.log(that.message)
                })
            }
        }

        obj.init();
    </script>
</body>
</html>